﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace BanditGame
{
    /// <summary>
    /// Default constants
    /// </summary>
    static class Defaults
    {
        /// <summary>
        /// Amount of lives that a player has at the start of each game
        /// </summary>
        public const int InitialLifeCount = 2;

        /// <summary>
        /// Default time for bandit moves delay
        /// </summary>
        public const int KeyDownDelayForBandit = 300;


        #region Gamefield properties 
            /// <summary>
            /// Cell edge size in pixels
            /// </summary>
            public const int CellSizeInPixel = 25;
        
            /// <summary>
            /// Gamefield max width in pixels
            /// </summary>
            public const int MaxCanvasWidth = 800;

            /// <summary>
            /// Gamefield max height in pixels
            /// </summary>
            public const int MaxCanvasHeight = 600;

            /// <summary>
            /// Maximal Game fiels width - MaxCanvasWidth/CellSizeInPixel
            /// </summary>
            public const int MaxGameFieldWidth = 31;

            /// <summary>
            /// Maximal Game fiels width - MaxCanvasHeight/CellSizeInPixel
            /// </summary>
            public const int MaxGameFieldHeight = 23;
        #endregion












        //private static Random random = new Random();

        ///// <summary>
        ///// Loads the game levels from the default Levels.xml file
        ///// </summary>
        ///// <returns></returns>
        //public static List<Level> LoadLevels()
        //{
        //    System.IO.Stream str = typeof(Defaults).Assembly.GetManifestResourceStream("Shock.Levels.xml");
        //    string levelsXml = string.Empty;

        //    using (System.IO.StreamReader reader = new System.IO.StreamReader(str))
        //    {
        //        levelsXml = reader.ReadToEnd();
        //    }
        //    return LoadLevelsFromXml(levelsXml);
        //}

        ///// <summary>
        ///// Loads all levels from a given XML file
        ///// </summary>
        ///// <param name="xmlText"></param>
        ///// <returns></returns>
        //public static List<Level> LoadLevelsFromXml(string xmlText)
        //{
        //    List<Level> levels = new List<Level>(10);
        //    XmlReader reader = XmlReader.Create(new StringReader(xmlText));

        //    while (true)
        //    {
        //        reader.ReadToFollowing("Level");
        //        if (!reader.IsStartElement("Level"))
        //        {
        //            break;
        //        }

        //        Level level = new Level(reader.GetAttribute("Name"));
        //        reader.ReadToFollowing("Bricks");
        //        if ((!reader.IsEmptyElement) && (reader.ReadToDescendant("Brick")))
        //        {
        //            do
        //            {
        //                Brick brick = new Brick(
        //                    Defaults.BrickAppearanceFromString(reader.GetAttribute("Appearance")),
        //                    Defaults.BonusContentsFromString(reader.GetAttribute("Contents")),
        //                    bool.Parse(reader.GetAttribute("HasInfiniteLife")),
        //                    int.Parse(reader.GetAttribute("Life")),
        //                    int.Parse(reader.GetAttribute("PosX")),
        //                    int.Parse(reader.GetAttribute("PosY")));
        //                level.Bricks.Add(brick);
        //            } while (reader.ReadToNextSibling("Brick"));
        //        }

        //        levels.Add(level);
        //    }
        //    reader.Close();

        //    return levels;
        //}

        #region Scoring

        #endregion


        //#region Bonuses
        ///// <summary>
        ///// Default bonus image width (screen coords)
        ///// </summary>
        //public const double BonusWidth = 64;

        ///// <summary>
        ///// Default bonus image height (screen coords)
        ///// </summary>
        //public const double BonusHeight = 64;

        ///// <summary>
        ///// Default bonus speed Y in pixels/ms when falling
        ///// </summary>
        //public const double BonusSpeed = 0.15;

        ///// <summary>
        ///// Bonus image names matching with the BonusContents struct for any resolution
        ///// </summary>
        //private static string[] _bonusImageNames = new string[] { @"Images/Bonuses/_Balls3.png",
        //    @"Images/Bonuses/_Balls7.png", @"Images/Bonuses/_Magnet.png", 
        //    @"Images/Bonuses/_Weapon.png", @"Images/Bonuses/_SpeedUp.png", 
        //    @"Images/Bonuses/_SlowDown.png", @"Images/Bonuses/_EnlargeBalls.png",
        //    @"Images/Bonuses/_ReduceBalls.png", @"Images/Bonuses/_PlasmaBalls.png",
        //    @"Images/Bonuses/_NormalBalls.png", @"Images/Bonuses/_ExtraLife.png", 
        //    @"Images/Bonuses/_ExpandPaddle.png", @"Images/Bonuses/_ReducePaddle.png",
        //    @"Images/Bonuses/_NormalPaddle.png", @"Images/Bonuses/_Bomb.png",
        //    @"Images/Bonuses/_Random.png"};

        //private static Uri[] _bonusBitmaps;

        ///// <summary>
        ///// Retrieves the bitmap image Uri that can be used for creating a BitmapSource and
        ///// using it as ImageSource for a given bonus appearance at any resolution
        ///// </summary>
        ///// <param name="appearance"></param>
        ///// <returns></returns>
        //public static Uri GetBonusUri(BonusContents bonusContents)
        //{
        //    return _bonusBitmaps[(int)bonusContents];
        //}

        //#endregion
    }
}
